export default {
  /**
   * No action has been done for a long time
   * @param duration
   * @param callback
   * @returns {Promise<unknown>}
   * @constructor
   */
  NoActionWasTaken (duration = 10, callback, a) {
    this.timer = setInterval(() => {
      duration--
      if (duration <= 0) {
        callback()
      }
      callback(duration)
    }, 1000)
    window.addEventListener('click', (e) => {
      duration = 10
    })
    window.addEventListener('mousemove', (e) => {
      duration = 10
    })
    window.addEventListener('keydown', (e) => {
      duration = 10
    })
  }
}
